package kr.ac.kaist.ysproject.data;

import java.io.Serializable;
import java.util.Random;

import android.util.Log;

public class DataSmartMsgInfo implements Serializable {
	
	private static final long serialVersionUID = -4858260765927565239L;
	
	private int m_id = -1;
	private String m_name = "";
	private String m_time = "";
	private String m_timeDev = "";
	private String m_date = "";
	private String m_sendType = "";
	private String m_manualMsg = "";
	private String m_internalMsgUse = "";
	private String m_weeklyRepeat = "";
	private String m_category = "";
	private String m_respect = "";
	private String m_talkingWay = "";
	private String m_profId = "";
	private String m_nextSendTime = "";

	public DataSmartMsgInfo() {
	}

	public int getId() {return m_id;}

	public String getName() {return m_name;}

	public String getTime() {return m_time;}

	public String getTimeDev() {return m_timeDev;}

	public String getDate() {return m_date;}

	public String getSendType() {return m_sendType;}

	public String getManualMsg() {return m_manualMsg;}

	public String getInternalMsgUse() {return m_internalMsgUse;}

	public String getWeeklyRepeat() {return m_weeklyRepeat;}

	public String getCategory() {return m_category;}

	public String getRespect() {return m_respect;}

	public String getTalkingWay() {return m_talkingWay;}

	public String getProfId() {return m_profId;}
	
	public String getNextSendTime() {return m_nextSendTime;}

	public void setId(int id) {m_id = id;}

	public void setName(String name) {m_name = name;}

	public void setTime(String time) {m_time = time;}

	public void setTimeDev(String timeDev) {m_timeDev = timeDev;}

	public void setDate(String date) {m_date = date;}

	public void setSendType(String sendType) {m_sendType = sendType;}

	public void setManualMsg(String manualMsg) {m_manualMsg = manualMsg;}

	public void setInternalMsgUse(String internalMsgUse) {m_internalMsgUse = internalMsgUse;}

	public void setWeeklyRepeat(String weeklyRepeat) {m_weeklyRepeat = weeklyRepeat;}

	public void setCategory(String category) {m_category = category;}

	public void setRespect(String respect) {m_respect = respect;}

	public void setTalkingWay(String talkingWay) {m_talkingWay = talkingWay;}

	public void setProfId(String profId) {m_profId = profId;}
	
	public void setNextSendTime(String nextSendTime) {m_nextSendTime = nextSendTime;}
	
	public String newNextSendTime() {
		if (m_timeDev.equals("")) {
			return m_time;
		} else {
			String tok[] = m_time.split(":");
			int curTime = Integer.parseInt(tok[0]) * 60 + Integer.parseInt(tok[1]);

			Random rand = new Random();
			int randVal = rand.nextInt(Integer.parseInt(m_timeDev) + 1);
			
			int newTime;
			
			if (rand.nextInt(2) == 0) {
				// minus
				newTime = curTime - randVal;
			} else {
				// plus
				newTime = curTime + randVal;
			}
			
			String strNewTime = new String().format("%02d:%02d", newTime/60, newTime%60);
			
			Log.d("DataSmartMsgInfo", "m_time = " + m_time);
			Log.d("DataSmartMsgInfo", "randVal = " + randVal);
			Log.d("DataSmartMsgInfo", "strNewTime = " + strNewTime);

			return strNewTime;
		}
	}

}
